// 定义组件
const Home = { template: '<div><h1>Home Page</h1><p>Welcome to the home page!</p></div>' };
const About = { template: '<div><h1>About Page</h1><p>Learn more about us.</p></div>' };
const Contact = { template: '<div><h1>Contact Page</h1><p>Get in touch with us.</p></div>' };

// 配置路由
const routes = [
  { path: '/', component: Home },
  { path: '/about', component: About },
  { path: '/contact', component: Contact }
];

// 创建路由实例
const router = new VueRouter({
  routes // 简写，相当于 routes: routes
});

// 创建 Vue 实例
new Vue({
  el: '#app',
  router // 注入路由
});